using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
using Evaluation3.data;

namespace Evaluation3.data
{
    public class rights : MyDataTable
    {
        public static string rightId = "rightId";
        public static string shortDec = "shortDec";
        public static string longDec = "longDec";

        public rights()
            : base("rights")
        {
            //this.IsListTable =
            this.DataTableCaption = "rights";
        }

        protected override System.Data.OleDb.OleDbCommand SetSelectCommand()
        {
            OleDbCommand OleDbSelectCommand1 = new OleDbCommand();
            OleDbSelectCommand1.CommandText = "SELECT rightId, shortDec, longDec FROM rights";
            return OleDbSelectCommand1;
        }

        protected override System.Data.OleDb.OleDbCommand SetInsertCommand()
        {
            OleDbCommand OleDbInsertCommand1 = new OleDbCommand();
            OleDbInsertCommand1.CommandText = "INSERT INTO rights(rightId, shortDec, longDec) VALUES(?,?,?)";
            OleDbInsertCommand1.Parameters.AddRange(new System.Data.OleDb.OleDbParameter[] {
        new System.Data.OleDb.OleDbParameter("rightId",System.Data.OleDb.OleDbType.Integer,4,"rightId"),
        new System.Data.OleDb.OleDbParameter("shortDec",System.Data.OleDb.OleDbType.LongVarWChar,1073741823,"shortDec"),
        new System.Data.OleDb.OleDbParameter("longDec",System.Data.OleDb.OleDbType.LongVarWChar,1073741823,"longDec")});
            return OleDbInsertCommand1;
        }

        protected override System.Data.OleDb.OleDbCommand SetUpdateCommand()
        {
            OleDbCommand oleDbUpdateCommand1 = new OleDbCommand();
            oleDbUpdateCommand1.CommandText = "UPDATE rights SET rightId=?,shortDec=?,longDec=? WHERE (rightId=?) ";
            oleDbUpdateCommand1.Parameters.AddRange(new System.Data.OleDb.OleDbParameter[] {
        new System.Data.OleDb.OleDbParameter("rightId",System.Data.OleDb.OleDbType.Integer,4,"rightId"),
        new System.Data.OleDb.OleDbParameter("shortDec",System.Data.OleDb.OleDbType.LongVarWChar,1073741823,"shortDec"),
        new System.Data.OleDb.OleDbParameter("longDec",System.Data.OleDb.OleDbType.LongVarWChar,1073741823,"longDec"),
        new System.Data.OleDb.OleDbParameter("Original_rightId",System.Data.OleDb.OleDbType.Integer,4,System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)),"rightId",System.Data.DataRowVersion.Original, null)});
            return oleDbUpdateCommand1;
        }

        protected override System.Data.OleDb.OleDbCommand SetDeleteCommand()
        {
            OleDbCommand oleDbDeleteCommand1 = new OleDbCommand();
            oleDbDeleteCommand1.CommandText = "DELETE FROM rights WHERE (rightId=?) ";
            oleDbDeleteCommand1.Parameters.AddRange(new System.Data.OleDb.OleDbParameter[] {
        new System.Data.OleDb.OleDbParameter("Original_rightId",System.Data.OleDb.OleDbType.Integer,4,System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)),"rightId",System.Data.DataRowVersion.Original, null)});
            return oleDbDeleteCommand1;
        }

        protected override System.Data.Common.DataTableMapping SetMappingData()
        {
            return new System.Data.Common.DataTableMapping("Table", "rights", new System.Data.Common.DataColumnMapping[] {
        new System.Data.Common.DataColumnMapping("rightId","rightId"),
        new System.Data.Common.DataColumnMapping("shortDec","shortDec"),
        new System.Data.Common.DataColumnMapping("longDec","longDec")});
        }

        protected override System.Data.DataColumn[] SetPrimaryKey()
        {
            DataColumn[] PrimaryKeyColumns = new DataColumn[1];
            PrimaryKeyColumns[0] = this.Columns["rightId"];
            this.PrimaryKey = PrimaryKeyColumns;
            return PrimaryKeyColumns;
        }
    }
}